<template>
	<view class="set-box">
		<u-cell-group>
			<u-cell icon="account" title="用户信息" :isLink="true" url="/my-actions/personalInfo/personalInfo"></u-cell>
		</u-cell-group>

		<u-tabbar fixed placeholder safeAreaInsetBottom>
			<view @tap="logOut" class="save flex align-center justify-center">退出登录</view>
		</u-tabbar>
	</view>
</template>

<script setup>
	import {
		useStore
	} from 'vuex';
	const store = useStore();
	
	const logOut = () => {
		// 退出登录清空聊天
		store.commit('changeContent', 0);
		store.commit('changeChatList', []);
		uni.removeStorageSync('token');

		uni.showToast({
			title: '退出成功',
			icon: 'success',
			duration: 2000
		})

		setTimeout(() => {
			uni.reLaunch({
				url: '/pages/my/my'
			})
		}, 1200)
	}
</script>

<style lang="scss" scoped>
	.set-box {
		min-height: 100vh;
		background: #f8f8f8;
	}
	
	.save {
		margin-top: 20rpx;
		width: 720rpx;
		height: 80rpx;
		color: #fff;
		font-size: 32rpx;
		border-radius: 8rpx;
		background: #E5725F;
	}
</style>
